package com.zhou.framework.quartz.db;

import com.zhou.framework.common.SpringFactory;
import org.quartz.utils.ConnectionProvider;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * 为定时任务提供数据库连接
 * @author lang.zhou
 * @date 2019/12/22
 */
public class DBConfigProvider implements ConnectionProvider {

    @Override
    public Connection getConnection() throws SQLException {
        return SpringFactory.getBean(DataSource.class).getConnection();
    }

    @Override
    public void shutdown() throws SQLException {

    }

    @Override
    public void initialize() throws SQLException {

    }

}
